Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var e = require("../../../@babel/runtime/helpers/regeneratorRuntime"),
  t = require("../../../@babel/runtime/helpers/asyncToGenerator"),
  n = require("../../../utils/index"),
  a = Behavior({
    data: {
      isActiveModify: !1
    },
    methods: {
      onClickLabel: function (e) {
        var t, a = this,
          i = e.target.dataset.item;
        this.data.machineValue && i.id == (null === (t = this.data.machineValue) || void 0 === t ? void 0 : t.id) || (this.selectComponent("#form").setValues({
          machine: {
            id: i.id,
            name: i.name
          },
          brand: "",
          model: ""
        }), this.setData({
          machineValue: {
            id: i.id,
            name: i.name
          }
        }), n.operateDom.nextTick((function () {
          a.setDetail()
        })))
      },
      onBack: function () {
        $.jxAlert({
          mode: "confirm",
          hideClose: !0,
          title: "温馨提示",
          content: "您还未完善联系人信息，确定要退出吗？",
          confirmText: "继续完善",
          cancelText: "下次再来"
        }).catch((function () {
          $.router.back()
        }))
      },
      onDetailchange: function () {
        this.setData({
          isActiveModify: !0
        })
      },
      onMachineChange: function (e) {
        console.log(e)
        var type = e.detail.value.id;
        this.setData({
          type:type
        })
        var t, a = this;
        this.selectComponent("#form").setValues({
          brand: "",
          model: ""
        }), this.setData({
          machineValue: (null === (t = e.detail) || void 0 === t ? void 0 : t.value) || null
        }), n.operateDom.nextTick((function () {
          a.setDetail()
        }))
      },
      onBrandChange: function () {
        var e = this;
        this.selectComponent("#form").setValues({
          model: ""
        }), n.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      onModelChange: function () {
        var e = this;
        n.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      onLocationChange: function () {
        var e = this;
        n.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      setDetail: function () {
        var n = this;
        return t(e().mark((function t() {
          var a, i, o, c, r, l, s, u, d;
          return e().wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
              case 0:
                return a = n.data, i = a.uu_id, o = a.isActiveModify, e.next = 5, n.selectComponent("#form").getValues();
              case 5:
                c = e.sent, r = c.address, l = c.brand, s = c.model, u = c.machine, i || o || (d = "", r && (l || s || u) && (d += r.province_text + r.city_text, d += null != l && l.name ? " ".concat(null == l ? void 0 : l.name) : "", d += null != s && s.name ? " ".concat(null == s ? void 0 : s.name) : "", d += null != u && u.name ? " ".concat(null == u ? void 0 : u.name) : ""), n.selectComponent("#form").setValues({
                  detail: d
                }));
              case 11:
              case "end":
                return e.stop()
            }
          }), t)
        })))()
      }
    }
  });
exports.default = a;